home *** CD-ROM | disk | FTP | other *** search
- Path: inforamp.net!usenet
- From: pcurran@inforamp.net (Peter Curran)
- Newsgroups: comp.std.c
- Subject: Re: Restrictions on qsort compare function?
- Date: Tue, 09 Apr 1996 23:25:49 GMT
- Organization: PSC Enterprises
- Message-ID: <4kerk9$7ta@sam.inforamp.net>
- References: <4iokop$h4p@lyra.csx.cam.ac.uk> <4iqjar$2m9@usenet.pa.dec.com> <4jgltp$f9l@lyra.csx.cam.ac.uk> <828644274snz@genesis.demon.co.uk> <4k28t4$2g0@sam.inforamp.net> <828726582snz@genesis.demon.co.uk> <4k69bf$ehg@sam.inforamp.net> <828971813snz@genesis.demon.co.uk> <4kbl1l$74r@sam.inforamp.net> <9livf9cusp.fsf@marks.jyacc.com>
- Reply-To: pcurran@inforamp.net
- NNTP-Posting-Host: ts37-13.tor.istar.ca
- X-Newsreader: Forte Free Agent 1.0.82
-
- On Tue, 9 Apr 1996 14:54:14 GMT in article <9livf9cusp.fsf@marks.jyacc.com>
- jtrigg@marks.jyacc.com (Jim Trigg) (Jim Trigg) wrote:
-
- >So what happens if the array is large enough that qsort takes longer
- >than a second to complete? The return values from the comparison
- >function are no longer consistent. Is the compiler vendor then
- >obligated to produce an implementation of qsort that will complete a
- >sort in a constant amount of time? That is what breaks your
- >comparison function.
-
- AARRRGGHHH!! I presume you have just started reading this thread! (BTW,
- completing in half a second won't solve the problem if it happens to start a
- quarter of a second before time() changes.)
-
- I will not post any more on this, but I can't leave it like this. That is the
- WHOLE POINT of my hypothesized comparison function!!! To summarize:
-
- I defined when I consider a value to be less than/equal to/greater than another,
- and wrote a comparison function that implements this definition. The function
- is completely consistent with this definition. Whenever it is invoked, it will
- return the appropriate and correct value. This is what the standard requires me
- to do, and I have done it. Any problems should now lie with qsort(). The
- standard represents a contract between users and implementors of C. I have
- fulfillled my side of the bargain as a user - now it is the implementor's turn.
-
- This, of course, is unreasonable. I, of course, completely understand that it
- is virtually impossible to implement such a qsort(). However, IMHO, the
- standard as written requires it, and so the standard should be fixed - someday
- when The Committee has nothing better to do.
-
- --
- Peter Curran pcurran@inforamp.net
-
-